package com.example.consumer.controller;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * \* @author: bear
 * \* Date: 2022-04-08-15:19
 * \* describe:
 */
@RestController
public class MessageController {
	@Autowired
	private AmqpTemplate amqpTemplate;
	@Autowired
	private RabbitTemplate rabbitTemplate;

	@GetMapping("sendMessage")
	public String sendMessage(){
		Map<String,Object> map = new HashMap<>();
		map.put("k1",new Date());
		amqpTemplate.convertAndSend("myQueue",map);
		return "success";
	}
}
